package com.ssau.expert.core.model;

import com.ssau.expert.exception.IllegalOperationException;

/**
 * Author: Sergey Saiyan
 * Created: 19.09.13 14:13
 */
public enum Operation {
    MORE(">"),
    LESS("<"),
    MORE_EQUAL(">="),
    LESS_EQUAL("<="),
    EQUAL("=="),
    NOT_EQUAL("!="),
    ASSIGN(":=");

    private String id;

    Operation(String id) {
        this.id = id;
    }

    public static Operation fromId(String id) throws IllegalOperationException {
        for (Operation op : Operation.values()) {
            if (op.id.equals(id)) {
                return op;
            }
        }
        throw new IllegalOperationException(id);
    }
}
